
<template>
	<!-- 富文本  -->
	<view>
		<view class="top_bg_img">
			<image src="http://qiniu.suboshimuying.cn/static/merchant/editBg.png" mode=""></image>
		</view>
		<view class="main">
			<!-- 导航栏 -->
			<u-navbar leftText=" " title=" " :safeAreaInsetTop="true" :placeholder="true" bgColor="transparent"
				autoBack>
				<view class="u-nav-slot" slot="left">
					<u-icon name="arrow-left" size="22"></u-icon>
				</view>
			</u-navbar>
			<view class="mainBox">
				<view class="top_box">
					<view class="title">{{title}}</view>
				</view>
				<u-parse :content="content"></u-parse>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				content: "", //富文本内容
				title: "隐私协议"
			};
		},
		onLoad(option) {
			// 1:用户协议 2:隐私协议 3:服务协议
			console.log(option);

			switch (Number(option.type)) {
				case 1:
					this.title = "用户协议"
					this.getuserdet()
					break;
				case 2:
					this.title = "隐私协议"
					this.getpoldet()
					break;
				case 3:
					this.title = "服务协议"
					this.getserdet()
					break;
				default:
					break;
			}
		},
		methods: {
			// 获取用户协议
			async getuserdet() {
				let res = await this.$api.getuserdet()
				this.content = res.data
			},
			// 获取隐私协议
			async getpoldet() {
				let res = await this.$api.getpoldet()
				this.content = res.data
			},
			// 获取服务协议 
			async getserdet() {
				let res = await this.$api.getserdet()
				this.content = res.data
			},
		}
	}
</script>

<style lang="scss" scoped>
	.top_bg_img {
		position: relative;
		top: 0;

		image {
			width: 750rpx;
			height: 404rpx;
			opacity: 1;
		}
	}

	.main {
		position: absolute;
		top: 0;
		left: 32rpx;
		width: 686rpx;
		margin: 0 auto;
	}

	.mainBox {
		width: 686rpx;
		margin: 32rpx auto 0;

		.top_box {
			.title {
				color: rgba(0, 0, 0, 0.8);
				font-size: 40rpx;
				font-weight: 700;
				margin-bottom: 16rpx;
			}
		}
	}
</style>
